package message

import "time"

var (
	_ Message = new(MessageImpl)
)

type Message interface {
	GetClass() string // = msg.getClass().getName()
	GetTypeName() string

	GetId() string
	GetHeaderEntry(key string) string
	GetHeader() *map[string]string
	PutHeaderEntry(string, string)
	SetServiceId(string)
	GetServiceId() string
}

type MessageImpl struct {
	Props      MessageProperties
	Headers    map[string]string
	Id         string
	ServiceId  string
	CreateTime time.Time
}

func (m *MessageImpl) GetId() string {
	return m.Id
}

func (m *MessageImpl) GetClass() string {
	return "MessageImpl"
}

func (m *MessageImpl) GetHeaderEntry(key string) string {
	return m.Headers[key]
}

func (m *MessageImpl) GetHeader() *map[string]string {
	return &m.Headers
}

func (m *MessageImpl) PutHeaderEntry(k, v string) {
	m.Headers[k] = v
}

func (m *MessageImpl) SetServiceId(serviceId string) {
	m.ServiceId = serviceId
}

func (m *MessageImpl) GetServiceId() string {
	return m.ServiceId
}

func (m *MessageImpl) GetTypeName() string {
	return ""
}
